package com.ophiux.utils.parser.entity;

import java.lang.reflect.Type;
import java.util.List;

import com.ophiux.utils.parser.Parser;

public class EntityTranslator implements Parser {

	public <T> T parse(Object source, Class<T> targetClz) {
		if (source == null) {
			return null;
		}
		return EntityConvert.translate(source, targetClz);
	}

	public <T> List<T> parse(List sources, Class<T> targetClz) {
		if (sources == null || sources.size() < 1) {
			return null;
		}
		return EntityConvert.translates(sources, targetClz);
	}

	public Object parse(Object source, Type type) {
		if (source == null) {
			return null;
		}
		return EntityConvert.translate(source, type);
	}

}
